home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / PowerD / powerd / source / lib / powerd_lib.lha / PowerD / BitCount.ass < prev    next >
Text File  |  2001-01-11  |  196b  |  15 lines

  1. ; d0 - value
  2.  
  3.     xdef    _BitCount
  4.  
  5. _BitCount    move.l    d2,a0
  6.     moveq    #0,d1
  7.     moveq    #31,d2    ; number of bit
  8. .loop    btst.l    d2,d0
  9.     beq.s    .skip
  10.     addq    #1,d1
  11. .skip    dbra.s    d2,.loop
  12.     move.l    d1,d0
  13.     move.l    a0,d2
  14.     rts
  15.